﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/MasterPageAdmin.master" AutoEventWireup="true" CodeFile="Quanlysanpham.aspx.cs" Inherits="admin_Quanlysanpham" ValidateRequest="false" %>

<%@ Register assembly="CKEditor.NET" namespace="CKEditor.NET" tagprefix="CKEditor" %>

<%@ Register assembly="FreeTextBox" namespace="FreeTextBoxControls" tagprefix="FTB" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript"> 
	<!--
    function showMe(it1,it2, box) {
        var vis1  = (box.checked) ? "block" : "none";
        document.getElementById(it1).style.display = vis1;
        var vis2 = (box.checked) ? "none" : "block";
        document.getElementById(it2).style.display = vis2;
    } 
	//--> 
</script>
 <style type="text/css">
        .headertilte{
         	font-size:35px;
            color:#39629F;
            font-weight:bold;
            text-align:center;
            margin:0;
            width:100%;
            padding:10px 0px 10px 0px;
            border-bottom:1px solid #ededed;
         	}
    </style>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
        
         <div style="border:1px solid gray;width:100%;height:auto;margin-bottom:20px;">
        <div style="width:100%;background-color:black;color:White;font-weight:bold;text-align:center;font-size:large">Quản Lý Sản Phẩm</div>
        <div>
            <table style="width: 100%;">
                <tr>
                    <td align="center" style="padding-left:10px;width:100px">
                        <asp:ImageButton ID="imbtnAdd" runat="server" 
                    ImageUrl="~/images/add-icon.png" ToolTip="Thêm Sản Phẩm Mới" 
                    onclick="imbtnAdd_Click" />
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <div style="margin-top:10px;margin-bottom:10px">
        Nhà Phân Phối:<asp:DropDownList ID="ddlnhaphanphoi" runat="server" 
            Width="140px" AutoPostBack="True" 
            onselectedindexchanged="ddlnhaphanphoi_SelectedIndexChanged">
            <asp:ListItem Selected="True">Tất Cả</asp:ListItem>
            <asp:ListItem>Đại Phát</asp:ListItem>
            <asp:ListItem>Việt Hàn</asp:ListItem>
        </asp:DropDownList>
        <asp:HiddenField ID="hdtimkiem" runat="server" />
    </div>
        <table width="100%">
            <tr>
                <td>
                    <asp:GridView ID="gvdtsanpham" runat="server" BorderColor="#999999" 
                        BorderStyle="Solid" BorderWidth="1px" 
                        CellPadding="4" style="margin-left: 0px" 
                        Width="100%" AllowPaging="True" 
             
                        EmptyDataText="Không Có Lo&#7841;i SP Nào" EnableModelValidation="True" 
                        AutoGenerateColumns="False" 
                        onpageindexchanging="gvdtsanpham_PageIndexChanging" 
                        onselectedindexchanged="gvdtsanpham_SelectedIndexChanged" 
                        onrowdatabound="gvdtsanpham_RowDataBound" 
                        onrowdeleting="gvdtsanpham_RowDeleting" GridLines="None" 
                        ForeColor="#333333">
                        <EmptyDataRowStyle Font-Bold="True" Font-Size="18pt" ForeColor="Red" HorizontalAlign="Center"  Height="50px" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                        
                            <asp:TemplateField HeaderText="STT">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text="<%# Container.DataItemIndex + 1 %>"></asp:Label> 
                                    <asp:HiddenField ID="hdfmasp" runat="server" Value='<%# Eval("MaSP") %>' />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" Width="15px" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="TenSP" HeaderText="Tên Sản Phẩm" >
                            <ItemStyle HorizontalAlign="Center" Width="200px" VerticalAlign="Middle" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="Hình">
                                <ItemTemplate>
                                    <asp:Image ID="Image1" runat="server" 
                                        ImageUrl='<%# "~/Images/Product/"+Eval("HinhAnh")+".jpg" %>' Width="60px" 
                                        Height="55px" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" Width="60px" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="TenNPP" HeaderText="Nhà Phân Phối" >
                            <ItemStyle Width="150px" HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>
                            <asp:BoundField DataField="DacDiem" HeaderText="Đặc Điểm" HtmlEncode="False" 
                                HtmlEncodeFormatString="False">
                            <ItemStyle Width="350px" HorizontalAlign="Left" VerticalAlign="Middle" />
                            </asp:BoundField>
                        
                            <asp:CommandField ShowSelectButton="True" SelectText="" ButtonType="Image" 
                                SelectImageUrl="~/images/file-edit-icon.png" >
                            <ItemStyle Width="60px" HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:CommandField>
                            <asp:CommandField ShowDeleteButton="True" DeleteText="" ButtonType="Image" 
                                DeleteImageUrl="~/images/Close-2-icon.png" >
                            <ItemStyle Width="60px" HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:CommandField>
                        </Columns>
                     
                        <FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" 
                            Font-Bold="False" Font-Size="Medium" Font-Strikeout="False" 
                            Font-Underline="True" VerticalAlign="Middle" Wrap="True"/>
                        <RowStyle ForeColor="#333333" BackColor="#FFFBD6" />
                        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                     
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
            </tr>
            <tr><td align="center" >
                
                </td></tr>
        </table>
        
            <p style="text-align:center">&nbsp;</p> 

   
        </asp:View>
        <asp:View ID="View2" runat="server">
        <div class="headertilte">
        <asp:Label ID="lbhead" runat="server" Text="Label"></asp:Label></div>
     <table border="0" cellpadding="0" cellspacing="0" width="780px">        
            <tr>
            <td style="height: 27px">
                &nbsp;</td>
            <td align="right" style="height: 27px">
             <asp:HyperLink ID="HLback" Text="« Quay lại" runat="server" Font-Bold="True" 
                    Font-Italic="True" NavigateUrl="~/admin/Quanlysanpham.aspx" ></asp:HyperLink>
            </td>
               
            </tr>
            </table>
        <table align="center" cellpadding="30" cellspacing="20" width="100%">
            <tr>
                <td>Tên Sản Phẩm:</td>
                <td style="padding-bottom:10px">
                    <asp:TextBox ID="txtTenSP" runat="server" Width="200px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="txtTenSP" ErrorMessage="*"></asp:RequiredFieldValidator>
                    <asp:HiddenField ID="hdfmasp" runat="server" />
                </td>
                <td rowspan="3" align="center" >
                    <img name="imgSanPham" id="imgSanPham" runat="server" height="80" width="80" border="1"/><br />
                    <input type="button" class="btupload" value=" Upload Picture" onclick='window.open("Uploadimage.aspx?ActUpload=sanpham","","width=420,height=200,menubar=no,scrollbars=yes")' />
                </td>
            </tr>
            <tr>
                <td>
                    Nhà Phân Phối</td>
                <td style="padding-bottom:10px">
                    <asp:DropDownList ID="ddlNhaPP" runat="server" DataTextField="TenNPP" 
                        DataValueField="MaNPP">
                    </asp:DropDownList>
                    <asp:HiddenField ID="hdimage" runat="server" />
                </td>
            </tr>
            <tr>
                <td >
                    Nhà Sản Xuất</td>
                <td style="padding-bottom:10px">
                    <div id="idnhasanxuat" style="float:left;width:150px">
                    <asp:DropDownList ID="ddlnhasanxuat" runat="server" DataTextField="TenNSX" 
                        DataValueField="MaNSX">
                    </asp:DropDownList>
                    </div>
                    <div id="idkhac" style="display:none;float:left">
                        <asp:TextBox ID="txtnhasanxuat" runat="server"></asp:TextBox>
                    </div>
                    <div>
                    <asp:CheckBox ID="ckkhac" runat="server" onclick="showMe('idkhac','idnhasanxuat', this)" 
                    Text="Khác" />
                    </div>
                </td>
            </tr>
            <tr>
                <td>Đặc Điểm:</td>
                <td colspan="2" style="padding-bottom:10px">
                    <asp:TextBox ID="ckDacDiem" runat="server" TextMode="MultiLine" Width="600px" Height="250px"></asp:TextBox>
                    <%--<CKEditor:CKEditorControl ID="ckDacDiem" runat="server"></CKEditor:CKEditorControl>--%>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="ckDacDiem" ErrorMessage="*"></asp:RequiredFieldValidator>
                    </td>
            </tr>
            <tr>
                <td>
                    Mô Tả:</td>
                <td colspan="2" style="padding-bottom:10px">
                    <FTB:FreeTextBox ID="ckMoTa" runat="server" 
                        AutoGenerateToolbarsFromString="True" ImageGalleryPath="~/Images/Product" 
                        
                        ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorP
                                            icker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough
                                            ,Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull
                                             ;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage|
                                             Cut,Copy,Paste,Delete;Undo,Redo,Print|SymbolsMenu|InsertRule,InsertDate,InsertTime
                                            ;InsertTable|InsertImageFromGallery,Preview,SelectAll,WordClean,NetSpell" 
                        Height="400px">
                    </FTB:FreeTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="ckMoTa" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="btnAddNew" runat="server" Height="31px" Text="Thêm mới" 
                        Width="69px" onclick="btnAddNew_Click" />
                    <asp:Button ID="btnEdit" runat="server" Height="31px" Text="Chỉnh sửa" 
                        Width="69px" onclick="btnEdit_Click" />
                    <asp:Button ID="btnHuy" runat="server" Height="31px"
                        Text="Hủy" Width="69px" onclick="btnHuy_Click" CausesValidation="False" />
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
            <td colspan="2" align="center">
                &nbsp;</td>
                <td align="center">
                    &nbsp;</td>
            </tr>
        </table>
        </asp:View>
    </asp:MultiView>
    
</asp:Content>

